import requests

# requests 是自动转义的
# url = 'https://www.baidu.com/s?wd=美女'
url = 'https://www.baidu.com/s'
params = {
    'wd':'汤小萌的博客'
}

headers = {
    "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36"
}
response = requests.get(url, headers=headers, params=params)

data = response.content.decode('utf-8')

with open('baidu.html', 'w', encoding='utf-8') as f:
    f.write(data)

# 发送POST请求和参数
requests.post(url,data=({}))


